<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
   xmlns:f="http://xmlns.jcp.org/jsf/core"
   xmlns:h="http://xmlns.jcp.org/jsf/html"
   xmlns:p="http://primefaces.org/ui"   
   xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
   template="/WEB-INF/templates/default.xhtml">
   
   	<f:metadata>	   	
	   	<f:viewParam name="firstResult" value="#{todoTaskList.firstResult}"></f:viewParam>	
	   	<f:viewParam name="processKey" value="#{todoTaskList.processKey}"></f:viewParam>
	   	<f:viewParam name="supplierName" value="#{todoTaskList.supplierName}"></f:viewParam>
	   	<f:viewParam name="assignee" value="#{todoTaskList.assignee}"></f:viewParam>
	   	<f:viewParam name="name" value="#{todoTaskList.name}"></f:viewParam>
	   	<f:viewParam name="dictId" value="#{todoTaskList.dictId}"></f:viewParam>
	   	<f:viewParam name="moduleName" value="信用申报审核"></f:viewParam>
   	</f:metadata>
   
   	<ui:define name="content">
   
		<h:form id="searchForm">
			<div style="height:80px;margin-left:10px;">	
				<p:outputLabel value="审批环节："></p:outputLabel>				
				<p:inputText value="#{todoTaskList.name}"></p:inputText>
				#{'    '}
				<p:outputLabel value="中介名称："></p:outputLabel>				
				<p:inputText value="#{todoTaskList.supplierName}"></p:inputText>
				#{'    '}
				<p:outputLabel value="评价事项："></p:outputLabel>				
				<p:selectOneMenu id="dict" widgetVar="dict" value="#{todoTaskList.dictId}" onchange="changeUrl()" style="width:200px">
					<f:selectItem itemLabel="-请选择-" itemValue="#{null}"/>
					<f:selectItems value="#{dictList.resultList}" var="_dict" itemLabel="#{_dict.title}" itemValue="#{_dict.id}"></f:selectItems>
				</p:selectOneMenu>
				#{'    '}
				<br/>	
				<div class="actionButtons" style="margin-top:10px;">
					<p:commandButton value="查询" ajax="false"  action="pendingReviewTaskList.xhtml?faces-redirect=true&amp;includeViewParams=true&amp;firstResult=0" styleClass="blue-int"></p:commandButton>
					#{'    '}
					<p:button value="重置" outcome="pendingReviewTaskList.xhtml?processKey=#{param.processKey}"></p:button>
				</div>			
				<p:link styleClass="btn" href="/rest/bpmn/todoTaskExport?processKey=#{param.processKey}" value="导出" />	   		
				<div class="clearbt"></div>
			</div>	
			<p:panel id="searchResult">
				<f:facet name="header">#{todoTaskList.processKey == 'backendAssessRecordAudit' ? '中介机构评价申报审核' : '中介机构失信申报审核'}</f:facet>
				<p:dataTable value="#{todoTaskList.resultList}" var="_task">
				
					<p:column headerText="审批环节">
						<h:outputText value="#{_task.name}" />
					</p:column>
										
					<p:column>
						<f:facet name="header">中介机构名称</f:facet>
						<h:outputText value="#{_task.processVariables['serviceSupplier'].cnname}" />		
					</p:column>
					
					<p:column>
						<f:facet name="header">评价事项</f:facet>
						<h:outputText value="#{_task.processVariables['dict'].title}" />
					</p:column>
					
					<p:column headerText="提交时间">
						<h:outputText value="#{_task.createTime}">
							<f:convertDateTime pattern="yyyy-MM-dd HH:mm"/>
						</h:outputText>
					</p:column>
										
					<p:column width="120" style="text-align: center;">
						<f:facet name="header">操作</f:facet>
						<p:button value="审核" outcome="#{_task.formKey}">
							<f:param name="taskId" value="#{_task.id}"></f:param>
						</p:button>
					</p:column>
					
				</p:dataTable>
				<ui:include src="/WEB-INF/templates/manage/pagination.xhtml">
					<ui:param name="entityList" value="#{todoTaskList}" />
				</ui:include>
			</p:panel>
			<script >
				var processKey = '#{param.processKey}';
				function changeUrl(){
					var dictTitle = PF('dict').getSelectedLabel();
		 			var dictId  = PF('dict').getSelectedValue();
					var downloadUrl = "#{request.getContextPath()}/rest/bpmn/todoTaskExport?processKey="+processKey+"&amp;dictId="+dictId+"&amp;dictTitle="+dictTitle;
		 			$(".btn").attr("href",downloadUrl);
				}
			</script>
		</h:form>
      
   	</ui:define>
</ui:composition>
